package com.example.epidemicmanagementsystemserver.controller;

import com.example.epidemicmanagementsystemserver.entity.User;
import com.example.epidemicmanagementsystemserver.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/*
控制层,用于连接前端和后端
 */
@RestController
@RequestMapping("/userlogin")
public class LoginController {

    @Autowired
    UserService userService;
    //登录验证
    @PostMapping("/user")
    public String login(@RequestBody User loginform){
        String  message = userService.login(loginform);
        return message;
    }
    //用户注册
    @PostMapping("/register")
    public String register(@RequestBody User reUser){

        String message = userService.register(reUser);
        return message;
    }
}
